home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / interapplication comm / finderlaunch / mpwtool / finderlaunchtool.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  1.5 KB  |  58 lines

  1. /*    File:        FinderLaunchTool.c
  2.     
  3.     Description: 
  4.              A test application for sending an open documents Apple event to the
  5.             Finder.  A sample mpw tool that asks the finder to launch any of the
  6.             objects provided on the command line.
  7.             
  8.  
  9.     Author:    John Montbriand
  10.  
  11.     Copyright: 
  12.             Copyright © 1999 by Apple Computer, Inc.
  13.             All rights reserved worldwide.
  14.     
  15.     Disclaimer:
  16.             You may incorporate this sample code into your applications without
  17.             restriction, though the sample code has been provided "AS IS" and the
  18.             responsibility for its operation is 100% yours.  However, what you are
  19.             not permitted to do is to redistribute the source as "DSC Sample Code"
  20.             after having made changes. If you're going to re-distribute the source,
  21.             we require that you make it clear in the source that the code was
  22.             descended from Apple Sample Code, but that you've made changes.
  23.     
  24.     Change History (most recent first):
  25.             9/13/99 created by John Montbriand
  26. */
  27.  
  28. #include <Types.h>
  29. #include <QuickDraw.h>
  30. #include <string.h>
  31. #include <strings.h>
  32. #include <StdIO.h>
  33. #include "FinderLaunch.h"
  34.  
  35.  
  36.  
  37. QDGlobals    qd; /* QuickDraw globals */
  38.  
  39.  
  40. int main(long argc, char** argv) {
  41.     Str255 name;
  42.     OSErr err;
  43.     long i;
  44.     FSSpec spec;
  45.     InitGraf(&qd.thePort);
  46.     for ( i=1; i<argc; i++) {
  47.         c2pstr(strcpy((char*)name, argv[i]));
  48.         err = FSMakeFSSpec(0, 0, name, &spec);
  49.         if (err != noErr) goto bail;
  50.         err = FinderLaunch(1, &spec);
  51.         if (err != noErr) goto bail;
  52.     }
  53.     return 0;
  54. bail:
  55.     fprintf(stderr, "\n# %s error = %d\n", argv[0], err);
  56.     return 1;
  57. }
  58.